Skip to content

Configure generated applications for component scanning - #16111

Open
jamesfredley wants to merge 2 commits into
8.0.xfrom
fix/14914-component-scan
Open

Configure generated applications for component scanning#16111
jamesfredley wants to merge 2 commits into
8.0.xfrom
fix/14914-component-scan

Conversation

@jamesfredley

Copy link
Copy Markdown
Contributor

Summary

  • add explicit base-package Spring component scanning to Forge-generated applications
  • keep base and plugin profile Application skeletons aligned with Forge output
  • verify all application types and standard Spring component injection without resources.groovy
  • document the generated scanning default separately from Grails artefact scanning

Verification

  • :grails-forge-core:check :test-core:check
  • :grails-profiles-base:check :grails-profiles-plugin:check
  • :grails-doc:publishGuide -x aggregateGroovydoc
  • GrailsApplicationSpec: 18 tests, 0 failures
  • CreateAppSpec generated-source matrix: 4 tests, 0 failures
  • mandatory Oracle and Codex review gate: GREEN

Closes #14914

Add base-package Spring component scanning to Forge and profile
Application templates, with generated-source and runtime coverage.

Closes #14914

Assisted-by: opencode:gpt-5.6-sol
@jamesfredley jamesfredley added this to the grails:8.0.0-RC1 milestone Aug 6, 2026
Copilot AI lite review requested due to automatic review settings August 6, 2026 19:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Adds explicit Spring base-package component scanning to Forge-generated and profile-skeleton Grails applications, aligning generated Application classes and documenting the new default.

Changes:

  • Add @ComponentScan to generated and profile-skeleton Application classes.
  • Update Forge tests to validate @ComponentScan across application types and verify standard Spring component injection.
  • Document the separation between Spring component scanning and Grails artefact scanning.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
grails-profiles/plugin/skeleton/grails-app/init/@grails.codegen.defaultPackage.path@/Application.groovy Adds @ComponentScan to plugin profile skeleton.
grails-profiles/base/skeleton/grails-app/init/@grails.codegen.defaultPackage.path@/Application.groovy Adds @ComponentScan to base profile skeleton.
grails-forge/test-core/src/test/groovy/org/grails/forge/create/CreateAppSpec.groovy Parameterizes Application template assertions and adds an integration test validating Spring component scanning.
grails-forge/grails-forge-core/src/test/groovy/org/grails/forge/feature/lang/GrailsApplicationSpec.groovy Asserts generated output includes @ComponentScan and validates profile skeleton templates.
grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/lang/groovy/application.rocker.raw Emits @ComponentScan in the generated Application template.
grails-doc/src/en/guide/conf/applicationClass/customizing.adoc Documents default Spring component scanning vs Grails artefact scanning.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jamesfredley jamesfredley self-assigned this Aug 6, 2026
Resolve profile templates independently of the test working directory and
assert the generated test task outcome through Gradle TestKit.

Assisted-by: opencode:gpt-5.6-sol
@codeconsole

Copy link
Copy Markdown
Contributor

Not sure if adding component scanning is a good idea. It's definitely not needed for anything created by the app.

The new bean dsl is a replacement for resources.groovy. You can now just specify whatever beans you want in Application.groovy in the beans closure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Update Forge and Profiles to configure component-scan for base package

3 participants